<?php
namespace App\Model\Movie;
use PhalApi\Model\DataModel;

class Banner extends DataModel {

    protected function getTableName($id) {
        return 'banner';
    }

    public function getList() {
        $res = $this->getORM()->select('*')->fetchAll();
        return $res;
    }
    public function searchList($domain) {
        $res = $this->getORM()->where(['domain'=>$domain])->select('*')->fetchAll();
        return $res;
    }
    public function getBannerList(){
        $res = $this->getORM()->select('pic')->fetchAll();
        foreach ($res as $key=>$value) {
            $res[$key]['src']=$value['pic'];
            unset($res[$key]['pic']);
        }
        return ['list'=>$res];
    }
}